ref(cells): Remove the legacy org invite route#112135
ref(cells): Remove the legacy org invite route#112135
Conversation
this removes the pre-silo organization invite path. this fundamentally does not work in the regional or cell world -- all org specific routes need to contain the org identifier (id or slug) in order to target the correct cell. since we have not sent invites using this path for many years, it should be safe to remove this is a prequisite to #112053 and other codebase cleanups
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
| name="sentry-api-0-data-export-notifications", | ||
| ), | ||
| re_path( | ||
| r"^accept-invite/(?P<member_id>[^/]+)/(?P<token>[^/]+)/$", | ||
| AcceptOrganizationInvite.as_view(), | ||
| name="sentry-api-0-accept-organization-invite", | ||
| ), | ||
| re_path( | ||
| r"^notification-defaults/$", |
There was a problem hiding this comment.
Bug: The removal of a legacy API invite endpoint is incomplete. Frontend code and backend tests still reference the deleted route, which will break user-facing functionality and CI tests.
Severity: HIGH
Suggested Fix
Update the frontend component in static/app/views/acceptOrganizationInvite/index.tsx to remove the conditional logic that calls the old endpoint, ensuring it always uses the new, organization-specific invite URL. Also, update the corresponding test file tests/sentry/api/endpoints/test_accept_organization_invite.py to remove references to the deleted route name sentry-api-0-accept-organization-invite.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: src/sentry/api/urls.py#L3792-L3795
Potential issue: The pull request removes the legacy API route
`/api/0/accept-invite/{memberId}/{token}/`, named
`sentry-api-0-accept-organization-invite`. However, the frontend code in
`static/app/views/acceptOrganizationInvite/index.tsx` was not updated and will still
attempt to call this removed endpoint for users on older invite links that lack an
organization slug. This will cause a 404 error, breaking the invitation acceptance flow
for those users. Additionally, backend tests in
`tests/sentry/api/endpoints/test_accept_organization_invite.py` still reference the
removed route name via `reverse()`, which will cause `NoReverseMatch` errors and break
the CI pipeline.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| DataExportNotificationsEndpoint.as_view(), | ||
| name="sentry-api-0-data-export-notifications", | ||
| ), | ||
| re_path( |
There was a problem hiding this comment.
Removed URL route still referenced in test helpers
High Severity
The deleted URL route named sentry-api-0-accept-organization-invite is still referenced in tests/sentry/api/endpoints/test_accept_organization_invite.py — in _get_paths() (line 39), _get_urls() (line 52), and a direct reverse() call (line 208). These helpers are used by nearly every test in AcceptInviteTest, so removing the route without updating the tests will cause NoReverseMatch failures across the entire test class.
| DataExportNotificationsEndpoint.as_view(), | ||
| name="sentry-api-0-data-export-notifications", | ||
| ), | ||
| re_path( |
There was a problem hiding this comment.
Backend route removal breaks frontend invite fallback path
Medium Severity
The removed accept-invite/{member_id}/{token}/ API route is still called by the frontend component AcceptOrganizationInvite in static/app/views/acceptOrganizationInvite/index.tsx. When orgSlug is null (no orgId in URL params and no customer domain), both the useApiQuery GET (line 227) and the useMutation POST (line 246, constructed via string interpolation, not getApiUrl) will hit the now-removed endpoint, resulting in 404 errors. The web route sentry-accept-invite in web/urls.py still exists and renders this component, so this path is still reachable.
|
looks like this route is still used so there are some dependencies that need to be done first - we need to reomve it from the frontend and stop sending users to the old route first step: #112137 |
Backend Test FailuresFailures on
|
| name="sentry-api-0-data-export-notifications", | ||
| ), | ||
| re_path( | ||
| r"^accept-invite/(?P<member_id>[^/]+)/(?P<token>[^/]+)/$", | ||
| AcceptOrganizationInvite.as_view(), | ||
| name="sentry-api-0-accept-organization-invite", | ||
| ), | ||
| re_path( | ||
| r"^notification-defaults/$", |
There was a problem hiding this comment.
Bug: The backend route for legacy organization invites (/accept-invite/.../) is removed, but the frontend still has fallback logic that calls this endpoint, leading to a 404 error.
Severity: MEDIUM
Suggested Fix
The frontend code in static/app/views/acceptOrganizationInvite/index.tsx should be updated to remove the fallback logic that calls the legacy /accept-invite/.../ endpoint. Alternatively, revert the removal of the backend route until the corresponding frontend changes are merged. The associated test in index.spec.tsx that validates this legacy behavior should also be removed or updated.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: src/sentry/api/urls.py#L3783-L3786
Potential issue: This pull request removes the legacy backend API route
`sentry-api-0-accept-organization-invite` at
`/accept-invite/(?P<member_id>[^/]+)/(?P<token>[^/]+)/`. However, the frontend component
`acceptOrganizationInvite` still contains fallback logic that attempts to call this
removed endpoint. This occurs when a user accesses a legacy invite link without an
organization slug (e.g., `/accept/:memberId/:token/`). The frontend will render, but the
subsequent API call will fail with a 404 error, showing the user a generic "invalid
link" message instead of properly handling the invite. The frontend changes to remove
this dependency were not included in this PR.
|
superceded by #112513 -- temporary redirect needed |


this removes the pre-silo organization invite path.
this fundamentally does not work in the regional or cell world -- all org specific routes need to contain the org identifier (id or slug) in order to target the correct cell.
since we have not sent invites using this legacy path for many years, it should be safe to remove. all invites use the properly org-scoped
sentry-api-0-organization-accept-organization-inviteinsteadthis is a prerequisite to #112053 and other codebase cleanups
it depends on #112137 and some other frontend changes that need to happen first